package com.slwu.factory.easy;

/**
 * 简单工厂模式
 */
public class ProductFactory {
    public static Product createProduct(ProductTypeEnum type) {
        if (type == null) {
            return null;
        }
        if (ProductTypeEnum.A.equals(type)) {
            return new ProductA();
        } else if (ProductTypeEnum.B.equals(type)) {
            return new ProductB();
        } else {
            return null;
        }
    }
}
